import { defineStore } from "pinia";
import { getAirspaceType } from "@/api/airSpace/airSpaceSetUp";

const useFootBtnsStore = defineStore('footBtn', {
  state: () => ({
    mapStyle: [
      {
        label: "卫星地图",
        id: "wxMap",
        src: import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/weixingMap.png",
        src1: import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/weixingMap1.png",
      },
      {
        label: "三维地图",
        id: "tMap",
        src: import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/tianMap.png",
        src1: import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/tianMap1.png",
      },
      {
        label: "矢量地图",
        id: "vectorMap",
        src: import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/tianMap.png",
        src1: import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/tianMap1.png",
      },
    ],
    airspace: [],
    airspaceId: [],
    airLine: [
      {
        label: "无人机航线",
        id: "wrjHX",
        children: [
          {
            label: "品牌无人机",
            id: "ppUAVHX",
          },
          {
            label: "自制无人机",
            id: "zzUAVHX",
          },
        ]
      },
      {
        label: "通航航线",
        id: "thHX",
        children: [
          {
            label: "私人飞机",
            id: "srfjHX",
          },
          {
            label: "微型飞机",
            id: "wxfjHX",
          },
          {
            label: "直升机",
            id: "zsjHX",
          },
          {
            label: "旋翼机",
            id: "xyjHX",
          },
          {
            label: "滑翔机",
            id: "hxjHX",
          },
        ]
      },
      {
        label: "其它航线",
        id: "qtHX",
        children: [
          {
            label: "航模",
            id: "hmHX",
          },
          {
            label: "飞艇",
            id: "ftHX",
          },
          {
            label: "热气球",
            id: "rqqHX",
          },
          {
            label: "氢气球",
            id: "qqqHX",
          },
          {
            label: "动力伞",
            id: "dlsHX",
          },
        ]
      },
    ],
    aircraft: [
      {
        label: "无人机",
        id: "wrj",
        children: [
          {
            label: "品牌无人机",
            id: "ppwrj",
          },
          {
            label: "自制无人机",
            id: "zzwrj",
          },
        ]
      },
      {
        label: "通航",
        id: "fj",
        children: [
          {
            label: "私人飞机",
            id: "srfj",
          },
          {
            label: "微型飞机",
            id: "wxfj",
          },
          {
            label: "直升机",
            id: "zsj",
          },
          {
            label: "旋翼机",
            id: "xyj",
          },
          {
            label: "滑翔机",
            id: "hxj",
          },
        ]
      },
      {
        label: "民航",
        id: "mhfj",
        children: [
          {
            label: "民航客机",
            id: "mh",
          },

        ]
      },
      {
        label: "其它",
        id: "qt",
        children: [
          {
            label: "航模",
            id: "hm",
          },
          {
            label: "飞艇",
            id: "ft",
          },
          {
            label: "热气球",
            id: "rqq",
          },
          {
            label: "氢气球",
            id: "qqq",
          },
          {
            label: "动力伞",
            id: "dls",
          },
        ]
      },
    ],
    device: [
      {
        label: "侦测系统",
        id: "zhenceXT",
        children: [
          {
            label: "无线电探测设备",
            id: "wuxiandian"
          },
          {
            label: "无线电监测设备",
            id: "zhence"
          },
          {
            label: "气象设备",
            id: "qixiang"
          }
        ]
      },
      {
        label: "反制系统",
        id: "fanzhiXT",
        children: [
          {
            label: "无线电压制设备",
            id: "fanzhi"
          },
          {
            label: "导航诱骗设备",
            id: "youpian"
          }
        ]
      },

    ],
    corp: [
      {
        label: "企业",
        id: "qiye",
      },
      {
        label: "民航机场",
        id: "mhAirport",
      },
      {
        label: "通航机场",
        id: "thAirport",
      },
      {
        label: "垂直机场",
        id: "czAirport",
      },
      {
        label: "无人机机场",
        id: "UAVAirport",
      },
    ],
    weather: [
      {
        label: "天气温度",  // 温度
        id: "temp",
      },
      {
        label: "风力风速", // 风力
        id: "windPower",
      },
      {
        label: "降雨降水", // 降水
        id: "rain",
      },
    ],
    defaultAirspace: []
  }),
  actions: {
    async getAirspace() {
      const { data } = await getAirspaceType();
      this.airspaceId = []
      this.airspace = data.map(item => {
        let src;
        let src1;
        switch (item.airTypeName) {
          case '禁飞区':
            src = import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/jinfei.png";
            src1 = import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/jinfei1.png";
            this.defaultAirspace.push(item.airTypeId);
            break;
          case "临时禁飞区":
            src = import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/linshi.png";
            src1 = import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/linshi1.png";
            break;
          case "轻型无人机适飞空域":
            src = import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/shifei.png";
            src1 = import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/shifei1.png";
            break;
          case '限高区':
            src = import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/xiangao.png";
            src1 = import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/xiangao1.png";
            // this.defaultAirspace.push(item.airTypeId);
            break;
          default:
            src = import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/jinfei.png";
            src1 = import.meta.env.VITE_BASE_PUBLICPATH + "/img/cockpit/jinfei1.png";
            break;
        }
        this.airspaceId.push(item.airTypeId)
        return {
          id: item.airTypeId,
          label: item.airTypeName,
          src,
          src1,
        }
      })
    }
  }

})

export default useFootBtnsStore;